package cn.cvs.config;

import cn.cvs.web.interceptor.AuthorizationInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    private String[] excludePathPatterns;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
       /* String[] pathPatterns={"/user/*","/role/*"}; //拦截路径规则
        String[] excludePathPatterns = {"/login/*","/register/*","/statics/**"};//排除路径规则,登录|注册|静态资源不拦截
        registry.addInterceptor(new AuthorizationInterceptor()) //注入拦截器
                .addPathPatterns(pathPatterns)      //添加拦截规则
                .excludePathPatterns(excludePathPatterns); //添加排除规则*/
    }
}
